import Vue from 'vue';
import App from './App.vue';
import router from './router';
import ElementUI from 'element-ui';
import store from './store'
import { preventReClick } from '@/api/plugins';
import 'element-ui/lib/theme-chalk/index.css'; // 默认主题

import './assets/css/icon/iconfont.css';
import './common/directives'; //拖拽
import 'babel-polyfill';
import less from 'less'
import * as echarts from 'echarts';
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
import fullscreen from 'vue-fullscreen'
Vue.use(fullscreen)

Vue.use(Viewer);
Viewer.setDefaults({
	Options: {
		"inline": true,
		"button": true,
		"navbar": true,
		"title": true,
		"toolbar": true,
		"tooltip": true,
		"movable": true,
		"zoomable": true,
		"rotatable": true,
		"scalable": true,
		"transition": true,
		"fullscreen": true,
		"keyboard": true,
		"url": "data-source"
	}
});
Vue.config.productionTip = false;
Vue.use(less)
// Vue.use(ElementUI);
// medium、small、mini
Vue.use(ElementUI, {
	size: 'medium'
});
const baseUrl = 'http://192.168.80.140:9005'
// const baseUrl = 'http://taiji.stycie.com'
import Sortable from 'sortablejs'
Vue.prototype.$baseUrl = baseUrl
Vue.prototype.$echarts = echarts
Vue.prototype.$sortable = Sortable

//获取url参数
let getQueryVariable = (name => {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
	if(window.location.href.split('?')[1]==null){
		return null;
	}
	var r=window.location.href.split('?')[1].match(reg)
	if (r != null) return unescape(r[2]);
	return null;
})
Vue.prototype.$getQueryVariable = getQueryVariable
// //使用钩子函数对路由进行权限跳转
// router.beforeEach((to, from, next) => {
// 	document.title = `九鼎报销系统`;//${to.meta.title} |
// 	const role = localStorage.getItem('user-token');
// 	if (!role && to.path!== '/demand') {
// 	  next({path:'/403'})
// 	} else if (to.meta.permission) {
// 	    // 如果是管理员权限则可进入，这里只是简单的模拟管理员权限而已
// 	    role === 'admin' ? next() : next('/403');
// 	} else {
// 	    next();
// 	}
// });

new Vue({
	router,
	store,
	render: h => h(App)
}).$mount('#app');
